package com.nowcoder.community.util;

public class RedisKeyUtils {
    private static final String POST_LIKE_SET_KEY           = "discuss.post:%d:like.count:set";
    private static final String COMMENT_LIKE_SET_KEY        = "comment:%d:like.count:set";
    private static final String USER_LIKE_COUNT_KEY         = "user:%d:like.count:int";
    private static final String USER_LIKE_HISTORY_KEY       = "user:%d:like.history:set";

    private static final String USER_FOLLOWER_ZSET_KEY      = "user:%d:follower:zset";
    private static final String USER_FOLLOW_ZSET_KEY        = "user:%d:follow:zset";
    private static final String USER_FOLLOW_HISTORY_KEY     = "user:%d:follow.history:set";

    private static final String CAPTCHA_KEY                 = "captcha:%s:string";
    private static final String USER_KEY                    = "user:%d:obj";
    private static final String LOGIN_TICKET_KEY            = "login.ticket:%s:obj";

    public static String getPostLikeSetKey(int id) {
        return String.format(POST_LIKE_SET_KEY, id);
    }

    public static String getCommentLikeSetKey(int id) {
        return String.format(COMMENT_LIKE_SET_KEY, id);
    }

    public static String getUserLikeCountKey(int userId) {
        return String.format(USER_LIKE_COUNT_KEY, userId);
    }

    public static String getUserLikeHistoryKey(int userId) {
        return String.format(USER_LIKE_HISTORY_KEY, userId);
    }

    public static String getUserFollowerZSetKey(int userId) {
        return String.format(USER_FOLLOWER_ZSET_KEY, userId);
    }

    public static String getUserFollowZSetKey(int userId) {
        return String.format(USER_FOLLOW_ZSET_KEY, userId);
    }

    public static String getCaptchaKey(String id) {
        return String.format(CAPTCHA_KEY, id);
    }

    public static String getLoginTicketKet(String ticket) {
        return String.format(LOGIN_TICKET_KEY, ticket);
    }

    public static String getUserKey(int id) {
        return String.format(USER_KEY, id);
    }

    public static String getUserFollowHistoryKey(int userId) {
        return String.format(USER_FOLLOW_HISTORY_KEY, userId);
    }
}
